package KTP;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

public class Lx05 {
    public static void main(String[] args) throws IOException {
        long pos;
        File f1 = new File("D:\\"+File.separator+"in.txt");
        f1.createNewFile();
        File f2 = new File("D:\\"+ File.separator+"out.txt");
        f2.createNewFile();

        byte[] b = new byte[(int) f1.length()];
        RandomAccessFile r1 = new RandomAccessFile(f1,"r");
        RandomAccessFile r2 = new RandomAccessFile(f2,"rw");
        pos = r2.length();
        r2.seek(pos);
        r1.read(b);
        r1.close();
        r2.close();
        System.out.println("添加成功");
    }
}
